package com.cn.gmall.weball.controller;

import com.cn.gmall.common.result.Result;
import com.cn.gmall.model.order.OrderInfo;
import com.cn.gmall.order.client.OrderFeignClient;
import com.sun.org.apache.bcel.internal.generic.RETURN;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import javax.jws.WebParam;
import javax.xml.crypto.Data;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

@Controller
public class PaymentController {
    @Resource
    private OrderFeignClient orderFeignClient;

    @GetMapping("/pay.html")
    public String toPay(Long orderId, Model model) {
        Result<OrderInfo> result = orderFeignClient.getOrderInfo(orderId);

        model.addAttribute("orderInfo", result.getData());
        return "payment/pay";
    }

    //    重定向到order成功页面
    @GetMapping("/pay/success.html")
    public String success() {

        return  "payment/success";
    }


}
